home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Surfer: Getting Started
/
Internet Surfer - Getting Started (Wayzata Technology)(7231)(1995).bin
/
pc
/
mac
/
bonus
/
peter_le
/
macbinar
/
mydeskto.uni
< prev
next >
Wrap
Text File
|
1992-12-06
|
2KB
|
71 lines
unit MyDesktopDB;
interface
const
bad_rn = -1;
function GetDesktopDB (vrn: integer; var rn: integer): OSErr;
{ You can safely ignore the error and use the returned rn in calls to Get/Set, they will just bounce }
procedure GetDTDBComment (rn: integer; var fs: FSSpec; var s: str255);
procedure SetDTDBComment (rn: integer; var fs: FSSpec; var s: str255);
implementation
function GetDesktopDB (vrn: integer; var rn: integer): OSErr;
var
pb: DTPBRec;
oe: OSErr;
v: longInt;
begin
rn := bad_rn;
oe := Gestalt(gestaltDBAccessMgrAttr, v);
if (oe = noErr) & BTST(v, gestaltDBAccessMgrPresent) then
oe := -1;
if oe = noErr then begin
pb.ioNamePtr := nil;
pb.ioVRefNum := vrn;
oe := PBDTGetPath(@pb);
if oe = noErr then
rn := pb.ioDTRefNum;
end;
GetDesktopDB := oe;
end;
procedure GetDTDBComment (rn: integer; var fs: FSSpec; var s: str255);
var
pb: DTPBRec;
oe: OSErr;
begin
s := '';
if rn <> bad_rn then begin
pb.ioNamePtr := @fs.name;
pb.ioDTRefNum := rn;
pb.ioDTBuffer := @s[1];
pb.ioDirID := fs.parID;
oe := PBDTGetComment(@pb, false);
if oe = noErr then begin
s[0] := chr(pb.ioDTActCount);
end
else
s := '';
end;
end;
procedure SetDTDBComment (rn: integer; var fs: FSSpec; var s: str255);
var
pb: DTPBRec;
oe: OSErr;
begin
s := '';
if rn <> bad_rn then begin
pb.ioNamePtr := @fs.name;
pb.ioDTRefNum := rn;
pb.ioDTBuffer := @s[1];
pb.ioDTReqCount := length(s);
pb.ioDirID := fs.parID;
oe := PBDTSetComment(@pb, false);
end;
end;
end.